home *** CD-ROM | disk | FTP | other *** search
- /
- / Copyright (C) 1990-1992 Michael Davidson.
- / All rights reserved.
- /
- / Permission to use, copy, modify, and distribute this software
- / and its documentation for any purpose and without fee is hereby
- / granted, provided that the above copyright notice appear in all
- / copies and that both that copyright notice and this permission
- / notice appear in supporting documentation.
- /
- / This software is provided "as is" without express or implied warranty.
- /
- .text
-
- R32Lookup = 0
- G32Lookup = 1024
- B32Lookup = 2048
-
- /
- / GammaCopyPixels24to24(
- / pixel24_t *src24,
- / pixel24_t *dst24,
- / int count
- / )
- /
- .globl GammaCopyPixels24to24
-
- SRC24 = 8
- DST24 = 12
- COUNT = 16
-
- GammaCopyPixels24to24:
- pushl %ebp
- movl %esp, %ebp
- pushl %esi
- pushl %edi
- pushl %ebx
-
- movl SRC24(%ebp), %esi
- movl DST24(%ebp), %edi
- shrl $2, COUNT(%ebp)
-
- xorl %ebx,%ebx
- xorl %edx,%edx
-
- jmp L01
-
- .align 4
- L00:
- xorl %eax, %eax
- xorl %ecx, %ecx
-
- movb (%esi), %al / R(0)
- movb 1(%esi), %bl / G(0)
-
- movb 3(%esi), %cl / R(1)
- movb 4(%esi), %dl / G(1)
-
- movl RGB32Lookup+R32Lookup(,%eax,4), %eax
- movl RGB32Lookup+R32Lookup(,%ecx,4), %ecx
- orl RGB32Lookup+G32Lookup(,%ebx,4), %eax
- orl RGB32Lookup+G32Lookup(,%edx,4), %ecx
-
- movb 2(%esi), %bl / B(0)
- movb 5(%esi), %dl / B(1)
-
- orl RGB32Lookup+B32Lookup(,%ebx,4), %eax
- orl RGB32Lookup+B32Lookup(,%edx,4), %ecx
-
- rorl $8, %ecx
- movw %cx, 0x4(%edi)
- xorw %cx, %cx
- orl %ecx, %eax
- movl %eax, (%edi)
-
- xorl %eax, %eax
- xorl %ecx, %ecx
-
- movb 6(%esi), %al / R(2)
- movb 7(%esi), %bl / G(2)
-
- movb 9(%esi), %cl / R(3)
- movb 10(%esi),%dl / G(3)
-
- movl RGB32Lookup+R32Lookup(,%eax,4), %eax
- movl RGB32Lookup+R32Lookup(,%ecx,4), %ecx
- orl RGB32Lookup+G32Lookup(,%ebx,4), %eax
- orl RGB32Lookup+G32Lookup(,%edx,4), %ecx
-
- movb 8(%esi), %bl / B(2)
- movb 11(%esi),%dl / B(3)
-
- orl RGB32Lookup+B32Lookup(,%ebx,4), %eax
- orl RGB32Lookup+B32Lookup(,%edx,4), %ecx
-
- movw %ax, 6(%edi)
- shll $8, %ecx
- shrl $16, %eax
- movb %al, %cl
- movl %ecx, 8(%edi)
-
- leal 12(%esi), %esi
- leal 12(%edi), %edi
-
- L01:
- decl COUNT(%ebp)
- jge L00
-
- popl %ebx
- popl %edi
- popl %esi
- popl %ebp
- ret
-
- /
- / GammaCopyPIxels24to16(
- / pixel24_t *src24,
- / pixel24_t *dst16,
- / int count
- / )
- /
- .globl GammaCopyPixels24to16
-
- SRC24 = 8
- DST16 = 12
- COUNT = 16
-
- GammaCopyPixels24to16:
- pushl %ebp
- movl %esp, %ebp
- pushl %esi
- pushl %edi
- pushl %ebx
-
- movl SRC24(%ebp), %esi
- movl DST16(%ebp), %edi
- shrl $1, COUNT(%ebp)
-
- xorl %eax, %eax
- xorl %ebx, %ebx
- xorl %ecx, %ecx
- xorl %edx, %edx
- jmp L21
-
- .align 4
- L20:
- movb (%esi), %al
- movb 1(%esi), %bl
- movb 2(%esi), %cl
-
- movw RGB32Lookup+R32Lookup(,%eax,4), %dx
- orw RGB32Lookup+G32Lookup(,%ebx,4), %dx
- orw RGB32Lookup+B32Lookup(,%ecx,4), %dx
-
- roll $16, %edx
-
- movb 3(%esi), %al
- movb 4(%esi), %bl
- movb 5(%esi), %cl
-
- movw RGB32Lookup+R32Lookup(,%eax,4), %dx
- orw RGB32Lookup+G32Lookup(,%ebx,4), %dx
- orw RGB32Lookup+B32Lookup(,%ecx,4), %dx
-
- roll $16, %edx
- movl %edx, (%edi)
-
- leal 6(%esi), %esi
- leal 4(%edi), %edi
- L21:
- decl COUNT(%ebp)
- jge L20
-
- popl %ebx
- popl %edi
- popl %esi
- popl %ebp
- ret
-
- /
- / CopyPixels24to8(
- / pixel24_t *src24,
- / pixel8_t *dst8,
- / int count,
- / pixel8_t *lookup
- / )
- /
- .globl CopyPixels24to8
-
- SRC24 = 8
- DST8 = 12
- COUNT = 16
- LOOKUP = 20
-
- CopyPixels24to8:
- pushl %ebp
- movl %esp, %ebp
- pushl %esi
- pushl %edi
- pushl %ebx
-
- movl SRC24(%ebp), %esi
- movl DST8(%ebp),%edi
- movl LOOKUP(%ebp),%ebx
- movl COUNT(%ebp),%ecx
- shrl %ecx
- jmp L31
- nop
- nop
-
- .align 4
- L30:
- xorl %eax, %eax
- xorl %edx, %edx
- movb (%esi), %al
- movb 3(%esi), %dl
- shll $5, %eax
- shll $5, %edx
- movb 1(%esi), %al
- movb 4(%esi), %dl
- shll $5, %eax
- shll $5, %edx
- movb 2(%esi), %al
- movb 5(%esi), %dl
- shrl $3, %eax
- shrl $3, %edx
- movb (%ebx,%eax,1), %al
- movb (%ebx,%edx,1), %ah
- movw %ax, (%edi)
- leal 6(%esi), %esi
- leal 2(%edi), %edi
- L31:
- decl %ecx
- jge L30
-
- popl %ebx
- popl %edi
- popl %esi
- popl %ebp
- ret
-